package com.winning.pmph.entity;

import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.annotation.TableId;
import com.winning.pmph.utils.Const;
import lombok.Data;
import org.apache.commons.lang.StringUtils;

import javax.persistence.Table;

/**
 * @author wu_di@winning.com.cn
 * @date 2020/11/2
 */
@Data
@Table(name = "last_edited_field")
public class LastEditedField {
    
    @TableId
    private String id;

    private String name;

    private int kind;

    private String property;

    private String knowledgeId;

    private boolean required;

    private JSONArray source;

    private int hidden;

    private String displayName;

    private String kindValue;

    public String getProperty() {
        return StringUtils.defaultIfEmpty(property, Const.KNOWLEDGE_FIELD_VALUE_DEFAULT.get(kind));
    }
}
